package pyrachnid.ctrl.listener;

import pyrachnid.ctrl.Observer;
import pyrachnid.ctrl.Simulator;
import pyrachnid.model.ChangeDirectionWind;
import pyrachnid.model.ChangeValueWind;
import pyrachnid.model.ground_model.Wind;
import pyrachnid.model.ground_model.Wind.Direction;
import pyrachnid.view.MainWindow;

public class listenerWind extends Observer {

	public listenerWind(Simulator p_sim, MainWindow p_view) {
		super(p_sim, p_view);
	}

	@Override
	public void update(Object p_o, String p_arg) {
		Wind wind = (Wind) p_o;

		if(p_arg.equals("Value Change"))
		{
			int force = wind.getForce();
			
			_view.valueForceWind(force);
			wind.addOperation(new ChangeValueWind(wind));
			//System.out.println("INFO : Wind force change to " + force + " in " + this.getClass().getName());
		}
		else if(p_arg.equals("Direction Change"))
		{
			Direction direction = wind.getDirection();
			
			_view.valueDirectionWind(direction);
			wind.addOperation(new ChangeDirectionWind(wind));
			System.out.println("INFO : Wind direction change to " + direction + " in " + this.getClass().getName());
			
		}
	}
}